<%@ page import="cn.school.entity.Subject" %>
<%@ page import="cn.school.service.SubjectService" %><%--
  Created by IntelliJ IDEA.
  User: ghost
  Date: 2019/12/5
  Time: 21:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    Subject s = new Subject();
    String gradeid = request.getParameter("gradeid");
    String subjectname = request.getParameter("subjectname");
    String classhour = request.getParameter("classhour");
    s.setGradeid(Long.parseLong(gradeid));
    s.setSubjectname(subjectname);
    s.setClassHour(Integer.parseInt(classhour));
    SubjectService ss = new SubjectService();
    int flag = ss.add(s);
    if(flag ==1){
        out.print(s.toString()+"<script>alert('添加成功！');</script>");
    }else{
        out.print(s.toString()+"<script>alert('添加失败！');</script>");
    }
%>
</body>
</html>
